import request from '@/utils/request'
/**
 * 分类接口
 */
// 根据类型查询分类
export const getCategoryList = (params) => {
  return request.get('/category/list', {
    params: params
  })
}

// 查询分类
export const getCategory = (params) => {
  return request.get('/category/page', {
    params: params
  })
}

// 启用、禁用分类
export const changeStatus = (status, id) => {
  return request({
    url: '/category/status/' + status,
    method: 'post',
    params: {
      id
    }
  })
}

// 根据ID删除分类
export const deleteCategory = (id) => {
  return request({
    url: '/category',
    method: 'delete',
    params: {
      id
    }
  })
}

// 新增分类
export const addCategory = (data) => {
  return request({
    url: '/category',
    method: 'post',
    data: data
  })
}

// 修改分类
export const editCategory = (data) => {
  return request({
    url: '/category',
    method: 'put',
    data: data
  })
}
